<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test Update Orders</title>
</head>
<body>
<h1>Test Update Orders</h1>
<button onclick="updateOrders()">Update Orders</button>

<script>
    async function updateOrders() {
        const url = '/put/updateOrder'; // 替换为你的实际服务器地址

        const params = [
            {
                "ORDER_NUM": 'ORD001-1',
                "UNIT_PRICE": 20.5,
                "AMOUNT": 100,
                "END_DATE": "2025-12-31",
                "START_DATE": "2025-01-01"
            },
            {
                "ORDER_NUM": 'ORD001-2',
                "UNIT_PRICE": 15.0,
                "AMOUNT": 200,
                "END_DATE": "2025-12-31",
                "START_DATE": "2025-01-01"
            }
        ];

        try {
            const response = await fetch(url, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(params)
            });

            const result = await response.json();
            console.log(result);
            alert(`Response: ${result.msg}`);
        } catch (error) {
            console.error('Error:', error);
            alert('Failed to update orders');
        }
    }
</script>
</body>
</html>
